package cn.agiledata.security.db.bean;

import cn.agiledata.security.db.service.IEnctListService;

import cn.agiledata.bank.common.util.Constant;
import cn.agiledata.bank.common.util.OperateUtil;
import cn.agiledata.bank.hibernateBean.Account;
import cn.agiledata.bank.hibernateBean.AccountBalance;
import cn.agiledata.bank.hibernateBean.Transaction;
import com.vnv.infrastructure.logic.IPBAppFactory;

public class EnctListBean {
	private Account a;
	private AccountBalance ab;
	private Transaction t;
	
	private IEnctListService enctListService;

	private String[] result_set;	//结果
	
	//Account表
	private String account_seq = "";
	private String account_name= "";
	private String account_email= "";
	private String account_mobile= "";
	
	
	
	//AccountBalance表
	private String accountBalance_seq= "";	//seq
	private String accountBalance_subAccountName= "";	//子帐户名称
	private String accountBalance_name= "";	//帐户名称
	private String accountBalance_balance= "";	//帐户余额
	private String accountBalance_lockAmount= "";	//冻结金额
	
	
	
	//Transaction表
	private String transaction_seq= "";	//transaction seq
	private String transaction_transId= "";	//交易编号
	private String transaction_actionType= "";	//交易类型
	private String transaction_creditName= "";	//收款方名称
	private String transaction_debitName= "";	//付款方名称
	private String transaction_amount= "";	//交易金额

	
	public EnctListBean(Object object) {
		if(object instanceof Account) {
			initAccount((Account)object);		
		}
		if(object instanceof AccountBalance) {
			initAccountBalance((AccountBalance)object);			
		}
		if(object instanceof Transaction) {
			initTransaction((Transaction)object);			
		}
	}
	

	
	public void initAccount(Account a) {
		this.a = a;	
		
		putService();
		
		result_set = getEncrResult(a);		
	}
	
	
	public void initAccountBalance(AccountBalance ab) {
		this.ab = ab;	
		
		putService();
		
		result_set = getEncrResult(ab);		
	}
	
	public void initTransaction(Transaction t) {
		this.t = t;	
		
		putService();
		
		result_set = getEncrResult(t);		
	}
	
	public void putService() {
		this.enctListService = (IEnctListService)IPBAppFactory.getObj("enctListService");
	}
	
	
	/**
	 * 得到检验结果
	 * @param object
	 * @return
	 */
	public String[] getEncrResult(Object object) {
		return enctListService.getEncrResult(object);
	}
	


	public Account getA() {
		return a;
	}

	public void setA(Account a) {
		this.a = a;
	}

	public AccountBalance getAb() {
		return ab;
	}

	public void setAb(AccountBalance ab) {
		this.ab = ab;
	}

	public String getAccount_email() {
		return a.getEmail();
	}

	public void setAccount_email(String account_email) {
		this.account_email = account_email;
	}

	public String getAccount_mobile() {
		return a.getMobile();
	}

	public void setAccount_mobile(String account_mobile) {
		this.account_mobile = account_mobile;
	}

	public String getAccount_name() {
		return a.getName();
	}

	public void setAccount_name(String account_name) {
		this.account_name = account_name;
	}



	public String getAccount_seq() {
		return a.getId().toString();
	}

	public void setAccount_seq(String account_seq) {
		this.account_seq = account_seq;
	}



	public String getAccountBalance_balance() {
		return OperateUtil.parseDec(ab.getBalance(),Constant.MONEY_FORMAT);
	}

	public void setAccountBalance_balance(String accountBalance_balance) {
		this.accountBalance_balance = accountBalance_balance;
	}

	public String getAccountBalance_lockAmount() {
		return OperateUtil.parseDec(ab.getLockAmount(),Constant.MONEY_FORMAT);
	}

	public void setAccountBalance_lockAmount(String accountBalance_lockAmount) {
		this.accountBalance_lockAmount = accountBalance_lockAmount;
	}

	public String getAccountBalance_name() {
		return ab.getSubAccount().getAccount().getName();
	}

	public void setAccountBalance_name(String accountBalance_name) {
		this.accountBalance_name = accountBalance_name;
	}



	public String getAccountBalance_seq() {
		return ab.getId().toString();
	}

	public void setAccountBalance_seq(String accountBalance_seq) {
		this.accountBalance_seq = accountBalance_seq;
	}

	public String getAccountBalance_subAccountName() {
		return ab.getSubAccount().getAccountName();
	}

	public void setAccountBalance_subAccountName(
			String accountBalance_subAccountName) {
		this.accountBalance_subAccountName = accountBalance_subAccountName;
	}

	public Transaction getT() {
		return t;
	}

	public void setT(Transaction t) {
		this.t = t;
	}

	public String getTransaction_actionType() {
		return t.getActionType().getActionName();
	}

	public void setTransaction_actionType(String transaction_actionType) {
		this.transaction_actionType = transaction_actionType;
	}

	public String getTransaction_amount() {
		return OperateUtil.parseDec(t.getAmount(), Constant.MONEY_FORMAT);
	}

	public void setTransaction_amount(String transaction_amount) {
		this.transaction_amount = transaction_amount;
	}

	public String getTransaction_creditName() {
		return t.getCredit().getAccount().getName();
	}

	public void setTransaction_creditName(String transaction_creditName) {
		this.transaction_creditName = transaction_creditName;
	}

	public String getTransaction_debitName() {
		return t.getDebit().getAccount().getName();
	}

	public void setTransaction_debitName(String transaction_debitName) {
		this.transaction_debitName = transaction_debitName;
	}



	public String getTransaction_seq() {
		return t.getId().toString();
	}

	public void setTransaction_seq(String transaction_seq) {
		this.transaction_seq = transaction_seq;
	}

	public String getTransaction_transId() {
		return t.getTransId();
	}

	public void setTransaction_transId(String transaction_transId) {
		this.transaction_transId = transaction_transId;
	}



	public IEnctListService getEnctListService() {
		return enctListService;
	}

	public void setEnctListService(IEnctListService enctListService) {
		this.enctListService = enctListService;
	}



	public String[] getResult_set() {
		return result_set;
	}



	public void setResult_set(String[] result_set) {
		this.result_set = result_set;
	}






}
